<template>
    <div>哈哈变帅ddd了</div>
    <h3>state:{{state}}</h3>
    <h3>age:{{age}}</h3>
    <h3>money:{{money}}</h3>

    <hr>
    <button @click="update">更新数据</button>

    <Child :age="age"></Child>
</template>

<script lang="ts">


import {defineComponent, reactive, ref, toRef} from "vue";
import Child from "./components/Child.vue";



export default defineComponent({
    name: "App",
    components: {
        Child
    },
    setup() {
        let state = reactive({
            age: 5,
            money: 100
        })
        // 响应式数据state对象中的某个属性age变成了ref对象
        let age = toRef(state, "age")
        debugger
        // 响应式对象中某个属性使用ref进行包装，变成一个ref对象
        let money = ref(state.money)
        console.log(age)
        console.log(money)
        return {
            state,
            age,
            money
        }
    }
});


/*@Options({
  components: {
    HelloWorld
  },
    name: "你好"
})*/
/*export default class App extends Vue implements ClassComponentHooks{
    // 初始化数据
    @Prop()
    private _msg = 123


    public mounted(): void {
    }

    public created(): void {
    }




    get computedMsg () {
      return ''
    }
}*/
</script>

<style>
#app {
    font-family: Avenir, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-align: center;
    color: #2c3e50;
    margin-top: 60px;
}
</style>